<template>
  <div class="permission">
    <div class="operate">
      <div>
        <ep-button :size="size" style="margin-left: 15px" icon="refresh.svg" @click="clearBtn"></ep-button>
      <column-manage :column.sync="tableColumn" @change="columnChange"></column-manage>

      </div>
<!--      <div>-->
<!--        <ep-button-->
<!--            :size="size"-->
<!--            style="margin-left: 15px"-->
<!--            icon="export.svg"-->
<!--            @click="-->
<!--            () => {-->
<!--              this.exportExcel();-->
<!--            }-->
<!--          "-->
<!--        >导出</ep-button-->
<!--        >-->
<!--      </div>-->
    </div>


    <a-modal
        title="处置任务排名"
        centered
        style=""
        width="90%"
        destroyOnClose
        :mask-closable="false"
        v-model="visible"
        @cancel="handleCancel"
    >
      <disposal-ranking-form ref="disposalRankingForm" @handleCancel="handleCancel" @showOrHide ="showOrHide"></disposal-ranking-form>
      <template slot="footer">
        <a-button @click="handleCancel">关闭</a-button>
      </template>
    </a-modal>
    <div class="ep-table">
      <zh-table height="auto"  ref="tasksTable"  row-id="roleId"
                :url="tableUrl" :columns="tableColumn" >
        <template #filter="{ $panel, column }">
          <input type="type" v-for="(option, index) in column.filters" :key="index" v-model="option.data" @input="$panel.changeOption($event, true, option)">
        </template>
        <template #operate="{ row }">
          <div class="alert-message">
            <i class="fa fa-exclamation-circle alert-message-icon"></i>
            <span class="alert-message-content">
              <ep-button status="primary" @click=showDetail(row)>查看</ep-button>
            </span>
          </div>
        </template>
        <template #wholeProgress="{ row }">
          <div class="alert-message">
            <i class="fa fa-exclamation-circle alert-message-icon"></i>
            <span class="alert-message-content">
                <ep-progress width="200px" :percent=row.wholeProgress></ep-progress>
            </span>
          </div>
        </template>
      </zh-table>
    </div>

  </div>
</template>
<script>
import {getFinishCaseList} from "@/services/system/whdngxlApi"
import moment from 'moment'
import ZhTable from "@/components/zh-table/ZhTable";
import {getBatchDict} from "@/services/system/api";
import UnmovableRelics from "@/pages/whdngxl/TasksCheckManage/UnmovableRelics";
import {mapGetters} from "vuex";
import DisposalRankingForm from "@/pages/system/form/DisposalRankingForm";
import ColumnManage from "@/components/assembly/columnManage";
export default {
  name: 'DisposalFinishCase',
  computed: {
    ...mapGetters(['size']),
  },
  components: {
    ColumnManage,
    DisposalRankingForm,
    ZhTable
  },
  data() {
    return {
      dictData: {},
      filtersData:{},
      tableColumn: [
        {field: 'c0303', title: '任务表代码',visible: false, align: 'center',},
        {field: 'c0303Name', title: '任务表',visible: true, align: 'center',filters:[], },
        {field: 'b0122', title: '县区编码',visible: false,align: 'center', },
        {field: 'b0107', title: '任务范围',visible: true, align: 'center',},
        {field: 'tasksNum',title: '任务总数',visible: true,sortable:true, align: 'center',},
        {
          field: 'operate', title: '街道排名', fixed: 'right', align: 'center', slots: {
            // 使用插槽模板渲染
            default: 'operate'
          }
        },
        {field: 'wholeProgress', title: '任务进度',align: 'center', slots: {
            // 使用插槽模板渲染
            default: 'wholeProgress'
          }},
      ],
      tableData: [],
      tableUrl: getFinishCaseList,
      toolbarConfig: {
        custom: true,
        slots: {}
      },
      visible: false,
      option:{data:''},
      manageRate:'',
    }
  },
  created() {
    this.$nextTick(() => {
      this.init()
    })
  },
  mounted() {
  },
  methods: {
    moment,
    init() {
      const params2 = {}
      params2.dictFields = 'c0303'
      this.$http.post(getBatchDict, params2).then(res => {
        this.dictData = res.result
        //获取筛选数据
        UnmovableRelics.methods.getFiltersData(this,'tasksTable')
      })
      this.findList()
    },
    findList() {
      this.$refs.tasksTable.query(this.queryParam)
    },
    clearBtn(){
      this.findList()
    },
    handleCancel() {
      this.visible=false
    },
    showOrHide() {
      this.visible=!this.visible
    },
    showDetail(row){
      this.showOrHide()
      this.$nextTick(()=>{
        this.$refs.disposalRankingForm.initData(row);
      })
    },
    filterRecoverMethod ({ option }) {
      option.data = ''
    },
    columnChange() {
      this.$refs.tasksTable.refreshColumn();
    },
  },
  watch: {
  }
}
</script>
<style lang="less" scoped>
.permission {
  //padding: 15px 20px 0;
  height: 100%;

  .desc,
  .operate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;

    > div {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
    }


  }

  .desc {
    margin-bottom: 20px;
  }

  .operate {
    margin-bottom: 15px;
    .field {
      flex: 0 0 auto;
      position: relative;
      margin-left: 15px;
      .field-box {
        position: absolute;
        top: 40px;
        left: 0;
        right: -40px;
        z-index: 99;
        border: 1px solid #2175a9;
        background: #002a44;
        border-radius: 5px;
        ul {
          padding: 10px;
          li {
            padding: 1px 0;
          }
        }
        .btn {
          display: flex;
          align-items: center;
          justify-content: space-between;
          padding: 5px;
          border-top: 1px solid #2175a9;
          color: #fff;
          p {
            flex: 1;
            text-align: center;
            cursor: pointer;
            &:hover {
              color: #49bbeb;
            }
          }
        }
      }
    }
  }
  .ep-table {
    height: calc(100% - 60px);
  }
}
</style>
